package cn.hanyx.coder.design.pattern.behavioral.memento.demo01;

import java.util.Stack;

/**
 * SnapshotHolder
 *
 * @author hanyx
 * @date 2020/07/29
 */
public class SnapshotHolder {
    private Stack<InputText> snaphots = new Stack<>();

    public InputText popSnaphots() {
        return snaphots.pop();
    }

    public void pushSnapshot(InputText inputText) {
        InputText deepClonedInputText = new InputText();
        deepClonedInputText.setText(inputText.getText());
        snaphots.push(deepClonedInputText);
    }
}
